package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.RecGpsInfoEntity;
import com.jinmdz.fmis.mapper.mapper.provider.RecGpsInfoProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 接运车辆GPS信息Mapper
 *
 * @author generator
 * @date 2020-06-22 14:03
 */
public interface RecGpsInfoMapper {

    /**
     * 增加RecGpsInfo
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-06-22 14:03
     */
    @InsertProvider(type = RecGpsInfoProvider.class, method = "insertRecGpsInfo")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertRecGpsInfo(@Param("entity") RecGpsInfoEntity entity);

    /**
     * 删除RecGpsInfo
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-06-22 14:03
     */
    @Update(" update rec_gps_info set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForRecGpsInfo(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改RecGpsInfo
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-06-22 14:03
     */
    @UpdateProvider(type = RecGpsInfoProvider.class, method = "updateRecGpsInfo")
    void updateRecGpsInfo(@Param("entity") RecGpsInfoEntity entity);

    /**
     * 查询RecGpsInfo实体
     *
     * @param id 主键
     * @return RecGpsInfoEntity
     * @author generator
     * @date 2020-06-22 14:03
     */
    @Select(" select id,deleted,car_imei,car_id,rec_id,device_status_code,gps_time,sys_time,heart_time,server_time,lng,lat,course,speed,status,acc,acc_seconds,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from rec_gps_info where id = #{id} and deleted = 0 limit 1 ")
    RecGpsInfoEntity getRecGpsInfoById(@Param("id") Integer id);

    /**
     * 查询RecGpsInfo列表
     *
     * @param entity 数据实体
     * @return RecGpsInfoEntity
     * @author generator
     * @date 2020-06-22 14:03
     */
    @SelectProvider(type = RecGpsInfoProvider.class, method = "listRecGpsInfo")
    ArrayList<RecGpsInfoEntity> listRecGpsInfo(@Param("entity") RecGpsInfoEntity entity);
}